// 此文件用于写入需要对比的数据列表

import store from '@/store'
import { jsonArray } from './steps/rateInfo/rateInfo'

/* 1.基本信息对比*/
export const baseInfo = [
	{ key: 'remark', value: '基础信息-备注' },
	{ key: 'isHoldFund', value: '是否持有期基金' },
	{ key: 'isListTransfer', value: '是否挂牌转让' },
	{ key: 'isBreakeven', value: '是否保本' },
	{ key: 'targetFundCode', value: '目标基金代码' },
	{ key: 'targetFundName', value: '目标基金名称' },
	{ key: 'isOrganCustom', value: '是否机构定制基金' },
	{ key: 'organCustom', value: '定制机构信息' },
	{ key: 'riskGrade', value: '风险等级' },
	{ key: 'innovateNatureRemark', value: '创新属性' },
	{ key: 'fundCode', value: '基金代码（六位）' },
	{ key: 'fundName', value: '产品简称' },
	{ key: 'fundFullName', value: '产品名称' },
	{ key: 'operateMode', value: '运作方式' },
	{ key: 'openFrequency', value: '开放频率（证监）' },
	{ key: 'openFrequencyRemark', value: '开放频率（证监）备注' },
	{ key: 'fiduciaryDuty', value: '受托责任' },
	{ key: 'settleCurrency', value: '结算币种' },
	{ key: 'faceValue', value: '面值' },
	{ key: 'fundType', value: '产品类别' },
	{ key: 'pobcFundType', value: '产品类型（人行二期）' },
	{ key: 'isQdii', value: '是否QDII' },
	{ key: 'isIndexFund', value: '是否指数基金' },
	{ key: 'isGradFund', value: '分级基金类型' },
	{ key: 'isMutualFund', value: '是否内地互认基金' },
	{ key: 'isActiveManage', value: '是否为主动管理' },
	{ key: 'managerStyle', value: '管理方式（人行二期）' },
	{ key: 'issuerEarlyTermFlag', value: '是否有发行机构提前终止权（人行二期）' },
	{ key: 'usufructTransferProductFlag', value: '是否收益权转让产品（人行二期）' },
	{ key: 'currencyMarketFundFlag', value: '是否货币市场基金（人行二期）' },
	{ key: 'isAddcreditMeasure', value: '产品资产是否存在增信措施（人行二期）' },
	{ key: 'addCreditFormType', value: '增信形式（人行二期）' },
	{ key: 'addCreditOrganType', value: '增信机构类型（人行二期）' },
	{ key: 'addcreditMeasureType', value: '增信措施类别' },
	{ key: 'isMom', value: '是否MOM' },
	{ key: 'revenueFeature', value: '收益特征' },
	{ key: 'isSubAssets', value: '是否子资产单元' },
	{ key: 'momFundCode', value: '管理人中管理人产品代码' },
	{ key: 'isNetWorthProduct', value: '是否净值型产品' },
	{ key: 'valuationWay', value: '估值方法' },
	{ key: 'valuationFrequency', value: '估值频率' },
	{ key: 'isRiskTacticsFund', value: '是否避险策略基金' },
	{ key: 'ensureObligorCode', value: '保障义务人代码' },
	{ key: 'ensureObligorName', value: '保障义务人名称' },
	{ key: 'isMarketTrade', value: '是否上市交易' },
	{ key: 'marketFundType', value: '上市基金类型' },
	{ key: 'marketTradeSite', value: '上市交易场所' },
	{ key: 'isPensionTargetFund', value: '是否养老目标基金' },
	{ key: 'investTactics', value: '投资策略' },
	{ key: 'isEtfJoinFund', value: '是否ETF联接基金' },
	{ key: 'isInnovateNature', value: '是否具备创新属性' },
	{ key: 'fundEnglishName', value: '产品英文名称' },
	{ key: 'evolveBeforeCode', value: '转型前产品正式代码' },
	{ key: 'performanceBaseline', value: '业绩比较基准' },
	{ key: 'fiduciaryDuty', value: '受托责任' },
	{ key: 'expectRaiseAmount', value: '预期募集金额' },
	{ key: 'incomeDisWay', value: '收益分配方式' },
	{ key: 'isHolderMeet', value: '是否设立持有人大会' },
	{ key: 'oneYardPassAccount', value: '一码通账户账号' },
	{ key: 'isActiveManage', value: '是否主动管理' },
	{ key: 'productBrand', value: '产品品牌（人行二期）' },
	{ key: 'productPeriod', value: '产品期次（人行二期）（四位）' },
	{ key: 'isSponsoredFund', value: '是否发起式基金' },
	{ key: 'sponsoredSelfCapital', value: '发起式自有资金' },
	{ key: 'sponsoredAgreedTerm', value: '发起式约定年限' },
	{ key: 'isFofFund', value: '是否FOF基金' },
	{ key: 'establishScale', value: '成立规模' },
	{ key: 'approvalSymbol', value: '核准文号' },
	{ key: 'isSingleShare', value: '是否单一份额' },
	{ key: 'mixedInvestBias', value: '混合型细分类' },
	{ key: 'newspaperId', value: '报社' },
	{ key: 'productAssetReportType', value: '产品类型（证监会资管月报）' },
	{ key: 'customerRedemptionFlag', value: '客户赎回权标识' },
	{ key: 'crossBorderFinancial', value: '跨境理财通（人行）' },
	{ key: 'propertyFundTrust', value: '以财产权信托名义开展的资金信托（人行）' },
	{ key: 'noneHKTIsStopApplyRansom', value: '非港股通交易日是否暂停申赎' }
]

/* 2.对比日期*/
export const dateInfo = [
	{ key: 'raiseStartDate', value: '募集起始日' },
	{ key: 'subsistTerm', value: '存续期限(年)' },
	{ key: 'formalEvolveDate', value: '正式转型日期' },
	{ key: 'nextOpenFirstDate', value: '下次开放期首日' },
	{ key: 'firstRedemptionDate', value: '首次打开赎回日' },
	{ key: 'approvalDate', value: '核准日期' },
	{ key: 'deferRaiseDate', value: '延期募集备案日期' },
	{ key: 'establishDate', value: '合同生效日' },
	{ key: 'logonApprovalChangeDate', value: '注册批文变更日期' },
	{ key: 'contractEndDate', value: '合同预计到期日（证监）' },
	{ key: 'contractEndDatePeople', value: '合同预计到期日（人行）' },
	{ key: 'liquidateAccompleteDate', value: '清盘完成日' },
	{ key: 'endListDate', value: '终止上市日' },
	{ key: 'operateEndDate', value: '合同实际到期日' },
	{ key: 'liquidationStartDate', value: '清算开始日期' }
]

/* 3.对比机构信息*/
export const organInfo = [
	{ key: 'managementId', value: '管理人名称' },
	{ key: 'isThirdPartyCustody', value: '是否第三方托管' },
	{ key: 'fundTaType', value: '登记机构名称' },
	{ key: 'trusteeId', value: '托管人名称' },
	{ key: 'custodyBranchOrganName', value: '托管人分支机构名称' },
	{ key: 'investAdvisorId', value: '投资顾问中文名称' },
	{ key: 'lawId', value: '律师事务所名称' },
	{ key: 'handleLawerName', value: '经办律师名称' },
	{ key: 'accountFirmId', value: '会计师事务所名称' },
	{ key: 'bordersCustodianName', value: '境外托管人中文名称' },
	{ key: 'bordersCustodianEnglishName', value: '境外托管人英文名称' },
	{ key: 'bordersAdvisorName', value: '境外投资顾问中文名称' },
	{ key: 'bordersAdvisorEnglishName', value: '境外投资顾问英文名称' }
	// { key: 'iscustodyBranchOrgan', value: '是否有托管分支机构' }
]

/* 5.对比投资相关信息*/
export const investInfo = [
	{ key: 'spclLimitRemark', value: '特殊投资限制备注' },
	{ key: 'isQuantTactics', value: '是否采用量化策略' },
	{ key: 'specialTypeChar', value: '是否特殊品种' },
	{ key: 'isContainSpclLimit', value: '是否包含特殊投资限制' },
	{ key: 'specialTypeName', value: '其他-特殊品种名' },
	{ key: 'isCoverTactics', value: '是否采用对冲策略' },
	{ key: 'stockMinRatio', value: '股票类资产投资最低比例' },
	{ key: 'stockMaxRatio', value: '股票类资产投资最高比例' },
	{ key: 'bondMinRatio', value: '债券类资产投资最低比例' },
	{ key: 'bondMaxRatio', value: '债券类资产投资最高比例' },
	{ key: 'currencyMinRatio', value: '货币类资产投资最低比例' },
	{ key: 'currencyMaxRatio', value: '货币类资产投资最高比例' },
	{ key: 'hkStockMaxRatio', value: '香港市场股票类资产投资最高比例' },
	{ key: 'remark', value: '投资相关-备注' }
]

// 对比费率
export const rateInfo = [
	{ key: 'feeRateAlgorithm', value: '管理费算法' },
	{ key: 'custodyFeeAlgorithm', value: '托管费算法' },
	{ key: 'isAchieveReward', value: '是否提取业绩报酬' },
	{ key: 'accrualPointTime', value: '计提时点' },
	{ key: 'accrualDatum', value: '计提基准' },
	{ key: 'rewardExplain', value: '业绩报酬说明' },
	{ key: 'accrualRatio', value: '计提比例' }
]

// 文件信息
export const fundFileInfo = [
	{
		type: '公募基金募集申请文件',
		typeName: [{
			title: '承诺函',
			objName: 'commitmentLetterId'
		},
		{
			title: '特殊承诺函',
			objName: 'specialLetterId'
		},
		{
			title: '申请报告',
			objName: 'applyReportId'
		},
		{
			title: '基金合同(申请文件)',
			objName: 'fundContractId'
		},
		{
			title: '托管协议(申请文件)',
			objName: 'trustAgreementId'
		},
		{
			title: '招募说明书(申请文件)',
			objName: 'enlistExplainId'
		},
		{
			title: '内部决议',
			objName: 'interResultId'
		},
		{
			title: '《法律意见书》',
			objName: 'lawProposalId'
		},
		{
			title: '《基金产品方案》',
			objName: 'fundPlanId'
		},
		{
			title: '指数使用协议',
			objName: 'applyAgreementId'
		},
		{
			title: '交易所无异议函',
			objName: 'tradeNoActionLetterId'
		},
		{
			title: '《基金合同填报指引》',
			objName: 'fundContractFillId'
		},
		{
			title: '认购发起份额的承诺函',
			objName: 'subscribeShareLetterId'
		},
		{
			title: '证监会要求的其他文件.zip',
			objName: 'otherMaterialsId10'
		}
		]
	},
	{
		type: '公募基金批复',
		typeName: [{
			title: '募集注册批复',
			objName: 'raiseLogonReplyId'
		},
		{
			title: '变更注册批复',
			objName: 'modifyLogonReplyId'
		},
		{
			title: '延期募集批复',
			objName: 'delayRaiseReplyId'
		},
		{
			title: '成立批复',
			objName: 'foundReplyId'
		}
		]
	},
	{
		type: '公募基金募集文件',
		typeName: [{
			title: '基金合同(募集文件)',
			objName: 'fundContractId2'
		},
		{
			title: '基金合同摘要',
			objName: 'fundContractRemark'
		},
		{
			title: '托管协议(募集文件)',
			objName: 'trustAgreementId2'
		},
		{
			title: '招募说明书(募集文件)',
			objName: 'enlistExplainId2'
		},
		{
			title: '招募说明书摘要',
			objName: 'enlistExplainRemark'
		},
		{
			title: '产品资料概要',
			objName: 'productDataResume'
		}
		]
	},
	{
		type: '公募其他文件',
		typeName: [{
			title: '期货备忘录',
			objName: 'otherMaterialsId9'
		}]
	},
	{
		type: '公募清算文件',
		typeName: [{
			title: '清算报告',
			objName: 'liquInfoationReportId'
		}]
	}
]

export function feeRateContrast() {
	const feeRaList = [
		{
			msg: '管理费率',
			feeRateType: '9'
		},
		{
			msg: '管理费率备注',
			feeRateType: '9'
		},
		{
			msg: '托管费率',
			feeRateType: '7'
		},
		{
			msg: '托管费率备注',
			feeRateType: '7'
		}
	]
	const apply = jsonArray(store.state.fundStep.pucliktTotalData.productFundApply)
	const baseInfo = apply && apply.baseInfo ? apply.baseInfo : {}
	const branchShareList = baseInfo.branchShareList && Array.isArray(baseInfo.branchShareList) ? baseInfo.branchShareList : []
	if (!branchShareList.length) { // 无下属基金
		const subRateList = {
			feeRateType: '1',
			msg: '普通认购',
			subFundType: ''
		}
		const subCntList = {
			feeRateType: '2',
			msg: '通过直销中心认购',
			subFundType: ''
		}
		const applyRateList = {
			feeRateType: '3',
			msg: '前端-普通申购',
			subFundType: ''
		}
		const applyRateList1 = {
			feeRateType: '10',
			msg: '后端-普通申购',
			subFundType: ''
		}
		const applyCntList = {
			feeRateType: '4',
			msg: '前端-通过直销中心申购',
			subFundType: ''
		}
		const applyCntList1 = {
			feeRateType: '11',
			msg: '后端-通过直销中心申购',
			subFundType: ''
		}
		const ransomRateList = {
			feeRateType: '5',
			msg: '普通赎回',
			subFundType: ''
		}
		const salesSerivceRate = {
			msg: '销售服务费率',
			feeRateType: '8',
			subFundType: ''
		}
		const salesSerivceRate1 = {
			msg: '销售服务费率备注',
			feeRateType: '8',
			subFundType: ''
		}
		const salesSerivceRate2 = {
			msg: '销售服务费算法',
			feeRateType: '8',
			subFundType: ''
		}
		feeRaList.push(subRateList)
		feeRaList.push(subCntList)
		feeRaList.push(applyRateList)
		feeRaList.push(applyRateList1)
		feeRaList.push(applyCntList)
		feeRaList.push(applyCntList1)
		feeRaList.push(ransomRateList)
		feeRaList.push(salesSerivceRate)
		feeRaList.push(salesSerivceRate1)
		feeRaList.push(salesSerivceRate2)
	} else { // 存在下属基金
		branchShareList.forEach(item => {
			if (item.subFundType === '1') { // 下属基金是A类
				const subRateList = {
					feeRateType: '1',
					msg: `${RateeTitle(item)}普通认购`,
					subFundType: item.subFundType
				}
				const subCntList = {
					feeRateType: '2',
					msg: `${RateeTitle(item)}通过直销中心认购`,
					subFundType: item.subFundType
				}
				const applyRateList = {
					feeRateType: '3',
					msg: `${RateeTitle(item)}前端-普通申购`,
					subFundType: item.subFundType
				}
				const applyRateList1 = {
					feeRateType: '10',
					msg: `${RateeTitle(item)}后端-普通申购`,
					subFundType: item.subFundType
				}
				const applyCntList = {
					feeRateType: '4',
					msg: `${RateeTitle(item)}前端-通过直销中心申购`,
					subFundType: item.subFundType
				}
				const applyCntList1 = {
					feeRateType: '11',
					msg: `${RateeTitle(item)}后端-通过直销中心申购`,
					subFundType: item.subFundType
				}
				const ransomRateList = {
					feeRateType: '5',
					msg: `${RateeTitle(item)}普通赎回`,
					subFundType: item.subFundType
				}
				const salesSerivceRate = {
					msg: `${RateeTitle(item)}销售服务费率`,
					feeRateType: '8',
					subFundType: item.subFundType
				}
				const salesSerivceRate1 = {
					msg: `${RateeTitle(item)}销售服务费率备注`,
					feeRateType: '8',
					subFundType: item.subFundType
				}
				const salesSerivceRate2 = {
					msg: `${RateeTitle(item)}销售服务费算法`,
					feeRateType: '8',
					subFundType: item.subFundType
				}
				feeRaList.push(subRateList)
				feeRaList.push(subCntList)
				feeRaList.push(applyRateList)
				feeRaList.push(applyRateList1)
				feeRaList.push(applyCntList)
				feeRaList.push(applyCntList1)
				feeRaList.push(ransomRateList)
				feeRaList.push(salesSerivceRate)
				feeRaList.push(salesSerivceRate1)
				feeRaList.push(salesSerivceRate2)
			} else { // 下属基金不是A类
				const subRateList = {
					feeRateType: '1',
					msg: `${RateeTitle(item)}普通认购`,
					subFundType: item.subFundType
				}
				const applyRateList = {
					feeRateType: '3',
					msg: `${RateeTitle(item)}前端-普通申购`,
					subFundType: item.subFundType
				}
				const applyRateList1 = {
					feeRateType: '10',
					msg: `${RateeTitle(item)}后端-普通申购`,
					subFundType: item.subFundType
				}
				const ransomRateList = {
					feeRateType: '5',
					msg: `${RateeTitle(item)}普通赎回`,
					subFundType: item.subFundType
				}
				const salesSerivceRate = {
					msg: `${RateeTitle(item)}销售服务费率`,
					feeRateType: '8',
					subFundType: item.subFundType
				}
				const salesSerivceRate1 = {
					msg: `${RateeTitle(item)}销售服务费率备注`,
					feeRateType: '8',
					subFundType: item.subFundType
				}
				const salesSerivceRate2 = {
					msg: `${RateeTitle(item)}销售服务费算法`,
					feeRateType: '8',
					subFundType: item.subFundType
				}
				feeRaList.push(subRateList)
				feeRaList.push(applyRateList)
				feeRaList.push(applyRateList1)
				feeRaList.push(ransomRateList)
				feeRaList.push(salesSerivceRate)
				feeRaList.push(salesSerivceRate1)
				feeRaList.push(salesSerivceRate2)
			}
		})
	}
	return jsonArray(feeRaList)
}

function RateeTitle(obj) { // 拼接标题
	const fundType = jsonArray(store.state.fundStep.subordinateFund)
	const item = fundType.find(item => item.typeCode === obj.subFundType)
	return `${item.typeName}-${obj.fundCode}-`
}
